arimaAIC <- function(x,maxCoef = 2,...){
  	arCoef <- 0:maxCoef
  	maCoef <- 0:maxCoef
  	coefs <- expand.grid(arCoef=arCoef,maCoef=maCoef)
  	mod <- apply(coefs,1,function(co,x,...){
    			warning <- c()
				res <- try({arima(x,order=c(co[1],0,co[2]),...)})
    			if(class(res)=="try-error"){
    				cat("Error in model order c(",co[1],",0,",co[2],")\n",sep="")
      				res <- list(aic=Inf)
    			}
    			res
  				},x,...)
  	aic <- sapply(mod,function(x)x$aic)
  	mod[[which(aic==min(aic))]]
}